// 例子36

{
    // 拷贝对象
    let x = {a: 1, b: 2};
    let y = {...x}; // 等同于let y = Object.assign({}, x);
    console.log(y); // {a: 1, b: 2}
}

console.log('----------------------------------');

{
    // 合并多个对象(重复值覆盖)
    let x = {a: 1, b: 2};
    let y = {b: 3, c: 4};
    let z = {c: 5, d: 6};
    let xyz = {...x, ...y, ...z}; // 等同于let xyz = Object.assign({}, x, y, z);
    let w = {...x, c: 10, e: 8, ...z}; // 等同于let w = Object.assign({}, x, {c: 10, e: 8}, z);
    console.log(xyz); // {a: 1, b: 3, c: 5, d: 6}
    console.log(w); // {a: 1, b: 2, c: 5, e: 8, d: 6}
}